import java.awt.*;
import java.awt.event.*;
public class TestTextField
{
	public static void main(String [] args)
	{
		TTextfield tt=new TTextfield();
		tt.frame();
	}
}

class TTextfield extends Frame
{
	TextField tf1,tf2,tf3;
	public void frame()
	{
		tf1=new TextField(10);
		tf2=new TextField(10);
		tf3=new TextField(10);
		Label l=new Label("+");
		Button b=new Button("=");
		b.addActionListener(new Mytest(this));
		setLayout(new FlowLayout());
		add(tf1);
		add(l);
		add(tf2);
		add(b);
		add(tf3);
		pack();
		setVisible(true);
	}
}

class Mytest implements ActionListener
{
	TTextfield tf=null;
	public Mytest(TTextfield tf)
	{
		this.tf=tf;
	}
	public void actionPerformed(ActionEvent e)
	{
		int n1=Integer.parseInt(tf.tf1.getText());
		int n2=Integer.parseInt(tf.tf2.getText());
		tf.tf3.setText(String.valueOf(n1+n2));

	}
}